<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>java</title>
    <link rel="stylesheet" th:href="@{/css/style.css}"/>
</head>
<body>
<div class="n-support">请使用Chrome、Safari等webkit内核的浏览器！</div>
<div class="n-head">
    <div class="g-doc f-cb">
        <div class="user" th:if="${session.user == null}">请<a th:href="@{/login}">[登录]</a></div>
        <div class="user" th:if="${session.user != null && session.user.userType == 1}">
            卖家你好，<span class="name" th:text="${session.user.username}"></span>！<a th:href="@{/logout}">[退出]</a>
        </div>
        <div class="user" th:if="${session.user != null && session.user.userType == 2}">
            买家你好，<span class="name" th:text="${session.user.username}"></span>！<a th:href="@{/logout}">[退出]</a>
        </div>
        <ul class="nav">
            <li><a th:href="@{/}">首页</a></li>
            <li th:if="${session.user != null && session.user.userType == 1}"><a th:href="@{/public}">发布</a></li>
            <li th:if="${session.user != null && session.user.userType == 2}"><a th:href="@{/account}">账务</a></li>
            <li th:if="${session.user != null && session.user.userType == 2}"><a th:href="@{/settleAccount}">购物车</a></li>
        </ul>
    </div>
</div>
<div class="g-doc">
    <div class="n-show f-cb" id="showContent">
        <div class="img"><img th:src="${commodity.pic}" th:alt="${commodity.title}"/></div>
        <div class="cnt">
            <h2>[[${commodity.title}]]</h2>
            <p class="summary">[[${commodity.summary}]]</p>
            <div class="price">
                <span class="v-unit">¥</span><span class="v-value">[[${commodity.price}]]</span>
            </div>
            <div class="num">
                购买数量：<span id="plusNum" class="lessNum"><a>-</a></span
            ><span class="totalNum" id="allNum">[[${commodity.count}]]</span
            ><span id="addNum" class="moreNum"><a>+</a></span>
            </div>
            <div class="oprt f-cb" th:if="${session.user != null && session.user.userType == 2 && (commodity.hasBuy == 2 || commodity.hasBuy == 0)}">
                <button class="u-btn u-btn-primary" id="add" th:data-id="${commodity.id}" th:data-price="${commodity.price}" th:data-title="${commodity.title}">加入购物车</button>
            </div>
            <div class="oprt f-cb" th:if="${session.user != null && session.user.userType == 2 && commodity.hasBuy == 1}">
                <span class="u-btn u-btn-primary z-dis">已购买</span>
                <span class="buyprice">当时购买价格：¥[[${commodity.buyPrice}]]</span>
            </div>
            <div class="oprt f-cb" th:if="${session.user != null && session.user.userType == 1}">
                <a th:href="@{/edit}+'?id='+${commodity.id}" class="u-btn u-btn-primary">编 辑</a>
            </div>
        </div>
    </div>
    <div class="m-tab m-tab-fw m-tab-simple f-cb">
        <h2>详细信息</h2>
    </div>
    <div class="n-detail" th:text="${commodity.text}"></div>
</div>
<div class="n-foot">
    <p>
        版权所有：网易云课堂<a
            href="http://mooc.study.163.com/smartSpec/detail/85002.htm"
    >Java开发工程师(Web方向)</a
    >微专业团队
    </p>
</div>
<script type="text/javascript" th:src="@{/js/global.js}"></script>
<script type="text/javascript" th:src="@{/js/pageShow.js}"></script>
</body>
</html>
